#Copyright Tyler Darnell

#This program is free software: you can redistribute it and/or modify
#it under the terms of the GNU General Public License as published by
#the Free Software Foundation, either version 3 of the License, or
#(at your option) any later version.

#This program is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#GNU General Public License for more details.

#You should have received a copy of the GNU General Public License
#along with this program.  If not, see <http://www.gnu.org/licenses/>.

import random

class Resc:
    #an actual resource
    #used in world class to define need for top level resources.
    #also used in business classes to determine prices
    demand = 0 #number between 1 and 1200
    type = ""
    rarity = 0 #number between 1 & 100, higher is more rare, thus more demand
    price = 0 #price per ton

    def __init__(self,name,rare):
        self.type = name
        self.rarity = rare

    def getNeed(self):
        #algorithm that determines demand, thus determines price down the calculation train
        #simple for now
        k = 12 #constant, don't ask why I chose it, likely to change. Based off commodity market data and the maelstrom known as my mind
        rnd = random.randrange(1,4) #get the RANDOM FACTOR-TOR-TOR
        self.demand = (k * self.rarity) / rnd #maixmum from this is 1200, hence the demand numbers
        print "Current demand: ", self.demand
        
    def getPrice(self):
        rnd = random.randrange(1, 9) #another factor to add dynamic-ism
        self.price = self.demand / rnd
        print "current price: ", self.price

class RescVein:
    type = Resc("tmp",-1) #generic vein of resources
    size = 0 #between 0 - 10

    def __init__(self, name, size):
        self.type = name
        self.size = size
        
